package cn.iocoder.yudao.module.crossborder.order.dal.mysql.orderreturn;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.crossborder.order.dal.dataobject.orderreturn.OrderReturnDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.crossborder.order.controller.admin.orderreturn.vo.*;

/**
 * 跨境电商退换货申请 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface OrderReturnMapper extends BaseMapperX<OrderReturnDO> {

    default PageResult<OrderReturnDO> selectPage(OrderReturnPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrderReturnDO>()
                .eqIfPresent(OrderReturnDO::getReturnNo, reqVO.getReturnNo())
                .eqIfPresent(OrderReturnDO::getOrderId, reqVO.getOrderId())
                .eqIfPresent(OrderReturnDO::getOrderNo, reqVO.getOrderNo())
                .eqIfPresent(OrderReturnDO::getCustomerId, reqVO.getCustomerId())
                .eqIfPresent(OrderReturnDO::getReturnType, reqVO.getReturnType())
                .eqIfPresent(OrderReturnDO::getReturnReason, reqVO.getReturnReason())
                .eqIfPresent(OrderReturnDO::getReturnReasonDesc, reqVO.getReturnReasonDesc())
                .eqIfPresent(OrderReturnDO::getTotalQuantity, reqVO.getTotalQuantity())
                .eqIfPresent(OrderReturnDO::getTotalAmount, reqVO.getTotalAmount())
                .eqIfPresent(OrderReturnDO::getRefundAmount, reqVO.getRefundAmount())
                .eqIfPresent(OrderReturnDO::getCurrencyCode, reqVO.getCurrencyCode())
                .eqIfPresent(OrderReturnDO::getReturnStatus, reqVO.getReturnStatus())
                .betweenIfPresent(OrderReturnDO::getApplyTime, reqVO.getApplyTime())
                .betweenIfPresent(OrderReturnDO::getApproveTime, reqVO.getApproveTime())
                .eqIfPresent(OrderReturnDO::getApproveUser, reqVO.getApproveUser())
                .eqIfPresent(OrderReturnDO::getApproveRemark, reqVO.getApproveRemark())
                .eqIfPresent(OrderReturnDO::getReturnDeadline, reqVO.getReturnDeadline())
                .eqIfPresent(OrderReturnDO::getReturnAddressId, reqVO.getReturnAddressId())
                .eqIfPresent(OrderReturnDO::getReturnShippingMethod, reqVO.getReturnShippingMethod())
                .eqIfPresent(OrderReturnDO::getReturnTrackingNo, reqVO.getReturnTrackingNo())
                .betweenIfPresent(OrderReturnDO::getReturnShipTime, reqVO.getReturnShipTime())
                .betweenIfPresent(OrderReturnDO::getReturnReceiveTime, reqVO.getReturnReceiveTime())
                .eqIfPresent(OrderReturnDO::getQualityCheckResult, reqVO.getQualityCheckResult())
                .betweenIfPresent(OrderReturnDO::getQualityCheckTime, reqVO.getQualityCheckTime())
                .eqIfPresent(OrderReturnDO::getQualityCheckUser, reqVO.getQualityCheckUser())
                .eqIfPresent(OrderReturnDO::getRefundMethod, reqVO.getRefundMethod())
                .betweenIfPresent(OrderReturnDO::getRefundTime, reqVO.getRefundTime())
                .eqIfPresent(OrderReturnDO::getRefundTransactionId, reqVO.getRefundTransactionId())
                .eqIfPresent(OrderReturnDO::getCustomerMessage, reqVO.getCustomerMessage())
                .eqIfPresent(OrderReturnDO::getInternalNotes, reqVO.getInternalNotes())
                .eqIfPresent(OrderReturnDO::getAttachments, reqVO.getAttachments())
                .betweenIfPresent(OrderReturnDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OrderReturnDO::getId));
    }

}